package com.fitns.user.mapper.baseConfig;

import static org.mybatis.dynamic.sql.SqlBuilder.*;

import com.fitns.user.model.baseConfig.TbOilException;

import java.util.List;
import javax.annotation.Generated;

import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.dynamic.sql.SqlBuilder;
import org.mybatis.dynamic.sql.delete.DeleteDSL;
import org.mybatis.dynamic.sql.delete.MyBatis3DeleteModelAdapter;
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
import org.mybatis.dynamic.sql.render.RenderingStrategy;
import org.mybatis.dynamic.sql.select.MyBatis3SelectModelAdapter;
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
import org.mybatis.dynamic.sql.select.SelectDSL;
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
import org.mybatis.dynamic.sql.update.MyBatis3UpdateModelAdapter;
import org.mybatis.dynamic.sql.update.UpdateDSL;
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;

@Mapper
public interface TbOilExceptionMapper {
    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    long count(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @DeleteProvider(type=SqlProviderAdapter.class, method="delete")
    int delete(DeleteStatementProvider deleteStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @InsertProvider(type=SqlProviderAdapter.class, method="insert")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
    int insert(InsertStatementProvider<TbOilException> insertStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @ResultMap("TbOilExceptionResult")
    TbOilException selectOne(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @SelectProvider(type=SqlProviderAdapter.class, method="select")
    @Results(id="TbOilExceptionResult", value = {
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="plate_num", property="plateNum", jdbcType=JdbcType.VARCHAR),
        @Result(column="organ_id", property="organId", jdbcType=JdbcType.BIGINT),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="driver", property="driver", jdbcType=JdbcType.BIGINT),
        @Result(column="lgitude", property="lgitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="exception", property="exception", jdbcType=JdbcType.VARCHAR),
        @Result(column="input_time", property="inputTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="before_oil", property="beforeOil", jdbcType=JdbcType.REAL),
        @Result(column="afters_oil", property="aftersOil", jdbcType=JdbcType.REAL),
        @Result(column="exception_oil", property="exceptionOil", jdbcType=JdbcType.REAL),
        @Result(column="exception_time", property="exceptionTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<TbOilException> selectMany(SelectStatementProvider selectStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    @UpdateProvider(type=SqlProviderAdapter.class, method="update")
    int update(UpdateStatementProvider updateStatement);

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
        return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
                .from(TbOilExceptionDynamicSqlSupport.tbOilException);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbOilExceptionDynamicSqlSupport.tbOilException);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int deleteByPrimaryKey(Long id_) {
        return DeleteDSL.deleteFromWithMapper(this::delete, TbOilExceptionDynamicSqlSupport.tbOilException)
                .where(TbOilExceptionDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insert(TbOilException record) {
        return insert(SqlBuilder.insert(record)
                .into(TbOilExceptionDynamicSqlSupport.tbOilException)
                .map(TbOilExceptionDynamicSqlSupport.plateNum).toProperty("plateNum")
                .map(TbOilExceptionDynamicSqlSupport.organId).toProperty("organId")
                .map(TbOilExceptionDynamicSqlSupport.type).toProperty("type")
                .map(TbOilExceptionDynamicSqlSupport.driver).toProperty("driver")
                .map(TbOilExceptionDynamicSqlSupport.lgitude).toProperty("lgitude")
                .map(TbOilExceptionDynamicSqlSupport.latitude).toProperty("latitude")
                .map(TbOilExceptionDynamicSqlSupport.exception).toProperty("exception")
                .map(TbOilExceptionDynamicSqlSupport.inputTime).toProperty("inputTime")
                .map(TbOilExceptionDynamicSqlSupport.beforeOil).toProperty("beforeOil")
                .map(TbOilExceptionDynamicSqlSupport.aftersOil).toProperty("aftersOil")
                .map(TbOilExceptionDynamicSqlSupport.exceptionOil).toProperty("exceptionOil")
                .map(TbOilExceptionDynamicSqlSupport.exceptionTime).toProperty("exceptionTime")
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int insertSelective(TbOilException record) {
        return insert(SqlBuilder.insert(record)
                .into(TbOilExceptionDynamicSqlSupport.tbOilException)
                .map(TbOilExceptionDynamicSqlSupport.plateNum).toPropertyWhenPresent("plateNum", record::getPlateNum)
                .map(TbOilExceptionDynamicSqlSupport.organId).toPropertyWhenPresent("organId", record::getOrganId)
                .map(TbOilExceptionDynamicSqlSupport.type).toPropertyWhenPresent("type", record::getType)
                .map(TbOilExceptionDynamicSqlSupport.driver).toPropertyWhenPresent("driver", record::getDriver)
                .map(TbOilExceptionDynamicSqlSupport.lgitude).toPropertyWhenPresent("lgitude", record::getLgitude)
                .map(TbOilExceptionDynamicSqlSupport.latitude).toPropertyWhenPresent("latitude", record::getLatitude)
                .map(TbOilExceptionDynamicSqlSupport.exception).toPropertyWhenPresent("exception", record::getException)
                .map(TbOilExceptionDynamicSqlSupport.inputTime).toPropertyWhenPresent("inputTime", record::getInputTime)
                .map(TbOilExceptionDynamicSqlSupport.beforeOil).toPropertyWhenPresent("beforeOil", record::getBeforeOil)
                .map(TbOilExceptionDynamicSqlSupport.aftersOil).toPropertyWhenPresent("aftersOil", record::getAftersOil)
                .map(TbOilExceptionDynamicSqlSupport.exceptionOil).toPropertyWhenPresent("exceptionOil", record::getExceptionOil)
                .map(TbOilExceptionDynamicSqlSupport.exceptionTime).toPropertyWhenPresent("exceptionTime", record::getExceptionTime)
                .build()
                .render(RenderingStrategy.MYBATIS3));
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbOilException>>> selectByExample() {
        return SelectDSL.selectWithMapper(this::selectMany, TbOilExceptionDynamicSqlSupport.id, TbOilExceptionDynamicSqlSupport.plateNum, TbOilExceptionDynamicSqlSupport.organId, TbOilExceptionDynamicSqlSupport.type, TbOilExceptionDynamicSqlSupport.driver, TbOilExceptionDynamicSqlSupport.lgitude, TbOilExceptionDynamicSqlSupport.latitude, TbOilExceptionDynamicSqlSupport.exception, TbOilExceptionDynamicSqlSupport.inputTime, TbOilExceptionDynamicSqlSupport.beforeOil, TbOilExceptionDynamicSqlSupport.aftersOil, TbOilExceptionDynamicSqlSupport.exceptionOil, TbOilExceptionDynamicSqlSupport.exceptionTime)
                .from(TbOilExceptionDynamicSqlSupport.tbOilException);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<TbOilException>>> selectDistinctByExample() {
        return SelectDSL.selectDistinctWithMapper(this::selectMany, TbOilExceptionDynamicSqlSupport.id, TbOilExceptionDynamicSqlSupport.plateNum, TbOilExceptionDynamicSqlSupport.organId, TbOilExceptionDynamicSqlSupport.type, TbOilExceptionDynamicSqlSupport.driver, TbOilExceptionDynamicSqlSupport.lgitude, TbOilExceptionDynamicSqlSupport.latitude, TbOilExceptionDynamicSqlSupport.exception, TbOilExceptionDynamicSqlSupport.inputTime, TbOilExceptionDynamicSqlSupport.beforeOil, TbOilExceptionDynamicSqlSupport.aftersOil, TbOilExceptionDynamicSqlSupport.exceptionOil, TbOilExceptionDynamicSqlSupport.exceptionTime)
                .from(TbOilExceptionDynamicSqlSupport.tbOilException);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default TbOilException selectByPrimaryKey(Long id_) {
        return SelectDSL.selectWithMapper(this::selectOne, TbOilExceptionDynamicSqlSupport.id, TbOilExceptionDynamicSqlSupport.plateNum, TbOilExceptionDynamicSqlSupport.organId, TbOilExceptionDynamicSqlSupport.type, TbOilExceptionDynamicSqlSupport.driver, TbOilExceptionDynamicSqlSupport.lgitude, TbOilExceptionDynamicSqlSupport.latitude, TbOilExceptionDynamicSqlSupport.exception, TbOilExceptionDynamicSqlSupport.inputTime, TbOilExceptionDynamicSqlSupport.beforeOil, TbOilExceptionDynamicSqlSupport.aftersOil, TbOilExceptionDynamicSqlSupport.exceptionOil, TbOilExceptionDynamicSqlSupport.exceptionTime)
                .from(TbOilExceptionDynamicSqlSupport.tbOilException)
                .where(TbOilExceptionDynamicSqlSupport.id, isEqualTo(id_))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(TbOilException record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilExceptionDynamicSqlSupport.tbOilException)
                .set(TbOilExceptionDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbOilExceptionDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbOilExceptionDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbOilExceptionDynamicSqlSupport.driver).equalTo(record::getDriver)
                .set(TbOilExceptionDynamicSqlSupport.lgitude).equalTo(record::getLgitude)
                .set(TbOilExceptionDynamicSqlSupport.latitude).equalTo(record::getLatitude)
                .set(TbOilExceptionDynamicSqlSupport.exception).equalTo(record::getException)
                .set(TbOilExceptionDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .set(TbOilExceptionDynamicSqlSupport.beforeOil).equalTo(record::getBeforeOil)
                .set(TbOilExceptionDynamicSqlSupport.aftersOil).equalTo(record::getAftersOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionOil).equalTo(record::getExceptionOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionTime).equalTo(record::getExceptionTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(TbOilException record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilExceptionDynamicSqlSupport.tbOilException)
                .set(TbOilExceptionDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbOilExceptionDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbOilExceptionDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbOilExceptionDynamicSqlSupport.driver).equalToWhenPresent(record::getDriver)
                .set(TbOilExceptionDynamicSqlSupport.lgitude).equalToWhenPresent(record::getLgitude)
                .set(TbOilExceptionDynamicSqlSupport.latitude).equalToWhenPresent(record::getLatitude)
                .set(TbOilExceptionDynamicSqlSupport.exception).equalToWhenPresent(record::getException)
                .set(TbOilExceptionDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .set(TbOilExceptionDynamicSqlSupport.beforeOil).equalToWhenPresent(record::getBeforeOil)
                .set(TbOilExceptionDynamicSqlSupport.aftersOil).equalToWhenPresent(record::getAftersOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionOil).equalToWhenPresent(record::getExceptionOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionTime).equalToWhenPresent(record::getExceptionTime);
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKey(TbOilException record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilExceptionDynamicSqlSupport.tbOilException)
                .set(TbOilExceptionDynamicSqlSupport.plateNum).equalTo(record::getPlateNum)
                .set(TbOilExceptionDynamicSqlSupport.organId).equalTo(record::getOrganId)
                .set(TbOilExceptionDynamicSqlSupport.type).equalTo(record::getType)
                .set(TbOilExceptionDynamicSqlSupport.driver).equalTo(record::getDriver)
                .set(TbOilExceptionDynamicSqlSupport.lgitude).equalTo(record::getLgitude)
                .set(TbOilExceptionDynamicSqlSupport.latitude).equalTo(record::getLatitude)
                .set(TbOilExceptionDynamicSqlSupport.exception).equalTo(record::getException)
                .set(TbOilExceptionDynamicSqlSupport.inputTime).equalTo(record::getInputTime)
                .set(TbOilExceptionDynamicSqlSupport.beforeOil).equalTo(record::getBeforeOil)
                .set(TbOilExceptionDynamicSqlSupport.aftersOil).equalTo(record::getAftersOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionOil).equalTo(record::getExceptionOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionTime).equalTo(record::getExceptionTime)
                .where(TbOilExceptionDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }

    @Generated("org.mybatis.generator.api.MyBatisGenerator")
    default int updateByPrimaryKeySelective(TbOilException record) {
        return UpdateDSL.updateWithMapper(this::update, TbOilExceptionDynamicSqlSupport.tbOilException)
                .set(TbOilExceptionDynamicSqlSupport.plateNum).equalToWhenPresent(record::getPlateNum)
                .set(TbOilExceptionDynamicSqlSupport.organId).equalToWhenPresent(record::getOrganId)
                .set(TbOilExceptionDynamicSqlSupport.type).equalToWhenPresent(record::getType)
                .set(TbOilExceptionDynamicSqlSupport.driver).equalToWhenPresent(record::getDriver)
                .set(TbOilExceptionDynamicSqlSupport.lgitude).equalToWhenPresent(record::getLgitude)
                .set(TbOilExceptionDynamicSqlSupport.latitude).equalToWhenPresent(record::getLatitude)
                .set(TbOilExceptionDynamicSqlSupport.exception).equalToWhenPresent(record::getException)
                .set(TbOilExceptionDynamicSqlSupport.inputTime).equalToWhenPresent(record::getInputTime)
                .set(TbOilExceptionDynamicSqlSupport.beforeOil).equalToWhenPresent(record::getBeforeOil)
                .set(TbOilExceptionDynamicSqlSupport.aftersOil).equalToWhenPresent(record::getAftersOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionOil).equalToWhenPresent(record::getExceptionOil)
                .set(TbOilExceptionDynamicSqlSupport.exceptionTime).equalToWhenPresent(record::getExceptionTime)
                .where(TbOilExceptionDynamicSqlSupport.id, isEqualTo(record::getId))
                .build()
                .execute();
    }
}